﻿
Public Class cCcostos

    Private ldtCCosto As dsContabilidad.CON_CCOSTODataTable
    Private lDrCCostos As dsContabilidad.CON_CCOSTORow
    Private lDaCCostos As dsContabilidadTableAdapters.CON_CCOSTOTableAdapter
    Sub New(ByVal idCcosto As String)
        ldtCCosto = New dsContabilidad.CON_CCOSTODataTable
        lDaCCostos = New dsContabilidadTableAdapters.CON_CCOSTOTableAdapter
        Try
            lDaCCostos.FillByIdCCosto(ldtCCosto, idCcosto)
            If ldtCCosto.Rows.Count > 0 Then
                lDrCCostos = ldtCCosto.Rows(0)
            Else
                Throw New Exception("No existe datos para este Centro de Costos")
            End If
        Catch ex As Exception
            cError.SalvaError(ex, "Samuel")
            Throw ex
        End Try
    End Sub
    Public ReadOnly Property idCcosto() As String
        Get
            Return lDrCCostos.IDCCOSTO
        End Get

    End Property

    Public ReadOnly Property descripcion() As String
        Get
            Return lDrCCostos.DESCRIPCION
        End Get

    End Property

    Public ReadOnly Property tipo() As eTipoCcosto
        Get
            Return lDrCCostos.TIPO
        End Get
        
    End Property

    Protected Overrides Sub Finalize()
        lDrCCostos = Nothing
        ldtCCosto = Nothing
        lDaCCostos = Nothing
    End Sub



End Class

Public Enum eTipoCcosto

    Ingresos = 1
    Egresos = 2
End Enum
